{extends file="../home.html"}

{block name="title"}{$head_title}{/block}
	
{block name="css"}
{/block}

{block name="content"}
<!--s主内容-->
<section class="content-wrapper">
  <div class="content-container container">
  	<!-- s面包屑导航 -->
  	{include file="../breadcrum_nav.html"}
  	<!-- e面包屑导航 -->
    <!-- s分类 -->
    <div class="col-left">
    {include file="../common_personal_nav.html"}
	</div>	
    <!-- e分类 -->
    <!-- s商品列表 -->
    <div class="col-main">
		{include file="../common_personal_header.html"}
		<!-- s主内容 -->
		<div class="user-main">
			<h6 class="form-title">返修/退换货</h6>
			<!-- 退货记录 -->
			<table class="table table-striped table-bordered table-condensed">
				<thead>
					<tr>
						<ul class="nav nav-pills">
						  <li>
						    <a href="{$refund_apply_link}{$order_info.order_id}">申请返修/退换货</a>
						  </li>
						  <li class="active"><a href="{$order_refund_detail_link}{$order_info.order_id}">查看返修/退换货记录</a></li>
						  {if $order_info.order_status == 6}<li class="fr active"><a href="javascript:;" onClick="refund_items();" style="background-color:#fabe00;">寄回货物</a></li>{/if}
						  {if $order_info.order_status == 7}<li class="fr active"><a href="javascript:;" style="color:#fabe00;background-color:transparent;">货物已寄回</a></li>{/if}
						</ul>
					</tr>
				</thead>
			    <thead>
		          <tr>
		            <th>退货编码</th>
		            <!-- <th>退货处理编码</th> -->
		            <th>订单编码</th>
		            <th>申请时间</th>
		            <th>处理时间</th>
		            <th>处理结果</th>
		            <th>处理说明</th>
		          </tr>
		        </thead>
		        <tbody>
		        {foreach from=$item_refund_list item=item}
		          <tr>
		            <td>{$item.item_refund_change_id}</td>
		            <!-- <td>121331</td> -->
		            <td>{$order_info.order_sn}</td>
		            <td>{$item.addtime|date_format:"%Y-%m-%d %H:%M:%S"}</td>
		            <td>{if $item.handle_time}{$item.handle_time|date_format:"%Y-%m-%d %H:%M:%S"}{else}--{/if}</td>
		            <td>{$item.state_name}</td>
		            <td>{$item.admin_remark}</td>
		          </tr>
		         {/foreach}
		        </tbody>
		      </table>

		      <!-- 退货商品信息 -->
		      <table class="table">
				<thead>
					<tr>
						<th>退货商品信息</th>
					</tr>
				</thead>
			    <thead>
		          <tr>
		            <th>订单编码</th>
		            <th>商品名称</th>
		            <th>商品数量</th>
		            <th>退款金额</th>
		          </tr>
		        </thead>
		        <tbody>
		        {foreach from=$item_list item=item1} 
		          {foreach from=$item1.diff_order_list item=item} 
		          <tr>
		            <td>{$order_info.order_sn}</td>
		            <td>{$item.item_name}</td>
		            <td>{$item.number}</td>
		            <td>{$item.real_price * $item.number}</td>
		          </tr>
		          {/foreach}
		        {/foreach}
		        </tbody>
		      </table>

		</div>
		<!-- e主内容 -->

	</div>
	<div class="clearfix"></div>
    <!-- e商品列表 -->
  </div>
</section>
<!--e主内容-->
{/block}

{block name="js"}
<script>
var order_id = '{$order_info.order_id}';
{literal}
$(function(){
	//小计计算
	$('.daily_itemNum').blur(function(){
		var _this = $(this);
		if(!_this.val().match(/^\d+$/) && _this.val() != ""){
			alert('请输入正确的数量');
			return;
		}
	});
});
function write_number(t)
{
      t.value = t.value.replace(/[^\d]/g,'');
}
//寄回货物
function refund_items()
{
	$.jPops.confirm(
	{  
		 title:"提示",  
		 content:"您确定已寄出货物了吗？",  
		 okBtnTxt:"确定",  
		 cancelBtnTxt:"取消",  
		 callback:function(r)
		 {  
			 if(r)
			 {
				$.post('/FrontOrder/set_order_state', {"order_id":order_id,"order_status":7}, function(data){
					if (data != 'failure')
					{
						alert('提交成功！');
					}
					else
					{
						alert('提交失败！');

					}
				});
			 }
			return true;
		 }
	 });

}
{/literal}
</script>
{/block}
